import { defineComponent, reactive, onMounted } from 'vue'
import Draw from './draw'
import {parkSum} from "@/api/api";
import {useRoute} from "vue-router";
import axios from "axios";
export default defineComponent({
  components: {
    Draw
  },
  setup() {
    const route = useRoute();
    const { url } = route.params;
    const cdata = reactive({
      linex1:[],
      liney1:[],

    })

    // 生命周期
    onMounted(() => {

      parkSum(url+'dataView/parkingLotBerth/distributionParkingHours',{})
          .then(res=>{
            console.log(res.data)
            for (let i = 0; i < res.data.length; i++) {
              cdata.liney1.push(res.data[i].count);
            }

            //this.cdata = { ...this.cdata }
          });

    })

    return () => {
      return <div>
        <Draw cdata={cdata} />
      </div>
    }
  }
})